/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_actor_model.h

	$Header: /heroes4/combat_actor_model.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_ACTOR_MODEL_H_INCLUDED )
#define COMBAT_ACTOR_MODEL_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "actor_model.h"
#include "cached_ptr.h"
#include "combat_actor_model_definition.h"

template < typename t_cached_type >
class t_cached_ptr;

// ------------------------------------------------------------------------------
// t_combat_actor_model class
// ------------------------------------------------------------------------------

class t_combat_actor_model
	:	public t_actor_model< t_combat_actor_model_definition >
{
public:
	// Types
	typedef t_combat_actor_action_id		t_action_id;
	typedef t_combat_actor_model_definition	t_definition;

	// Constructors/Destructor
	t_combat_actor_model( t_combat_actor_model const & other );
	explicit t_combat_actor_model( t_cached_ptr< t_definition > definition_ptr, double scale_ratio = 1.0 );
	virtual ~t_combat_actor_model();

	// Member functions
	int								get_height() const;
	int								get_key_frame( t_action_id action ) const;
	t_map_point_3d const&			get_missile_offset( t_direction direction ) const;
	int								get_postwalk_distance() const;
	int								get_prewalk_distance() const;
	virtual t_actor_sequence_ptr	get_sequence_ptr( t_action_id action_id, 
											          t_direction direction ) const;
	int get_walk_distance() const;

	// Operators
	t_combat_actor_model & operator=( t_combat_actor_model const & other );

protected:
	// Member functions
	virtual t_actor_sequence_cache  get_cache( std::string const&	name,
											  t_screen_point const&	offset ) const;

private:
	// Data members
	mutable t_actor_sequence_ptr m_current_sequence;
	double	                     m_scale_ratio;
};

// ------------------------------------------------------------------------------
// t_combat_actor_model inline members
// ------------------------------------------------------------------------------

// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
inline int t_combat_actor_model::get_height() const
{
	return get_definition().get_height();
}

inline int t_combat_actor_model::get_key_frame( t_action_id action ) const
{
	return get_definition().get_key_frame( action );
}

inline t_map_point_3d const& t_combat_actor_model::get_missile_offset( t_direction direction ) const
{
	return get_definition().get_missile_origin( direction );
}

inline int t_combat_actor_model::get_postwalk_distance() const
{
	return get_definition().get_postwalk_length();
}

inline int t_combat_actor_model::get_prewalk_distance() const
{
	return get_definition().get_prewalk_length();
}

inline int t_combat_actor_model::get_walk_distance() const
{
	return get_definition().get_walk_length();
}

#endif // !defined( COMBAT_ACTOR_MODEL_H_INCLUDED )
